package com.leyou.item.controller;

import com.leyou.item.server.BrandService;
import com.leyou.item.server.CategoryService;
import com.leyou.pojo.CategoryDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("category")
public class CategoryController {





    @Autowired
    private CategoryService categoryService;

    @GetMapping("/of/parent")
    public ResponseEntity<List<CategoryDTO>> queryByParentId(@RequestParam("pid") Long pid){
        return ResponseEntity.ok(categoryService.queryByParentId(pid));
    }
    @GetMapping("/of/brand/")
    public ResponseEntity<List<CategoryDTO>> queryByBrandId(@RequestParam("id") Long id){
        return ResponseEntity.ok(categoryService.queryByBrandId(id));
    }


}
